<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="layout.xhtml">
        <ui:define name="title">
            <h2><a href="#" class="back" onclick="history.go(-1)"/>Editar Usuário</h2>
        </ui:define>

        <ui:define name="body">
            <h:form id="clienteForm" enctype="multipart/form-data">            
                <p:messages id="messages" closable="true" showDetail="true" autoUpdate="true"  />
                <p> 
                    <p:panel id="dadosGeraisPanel" styleClass="container_24 clearfix">
                        <h2><a href="#">Dados Gerais</a></h2>
                        <br/>
                        <p:outputLabel value="Nome : " styleClass="grid_3"/>
                        <p:inputText  styleClass="grid_18" value="#{managerPesquisarUsuario.usuarioEditar.nome}"/>
                        <div class="clear"/>
                        <p:outputLabel value="Contato:" styleClass="grid_3" for="telInputText"/>
                        <p:inputMask  id="telInputText" mask="(99)9999-9999" styleClass="grid_5" value="#{managerPesquisarUsuario.usuarioEditar.telefone}"/>
                        <!--                        <div class="clear"/>-->
                        <p:outputLabel value="Email:" styleClass="grid_2" for="emailInputText"/>
                        <p:inputText id="emailInputText" styleClass="grid_10" style="width: 43%" value="#{managerPesquisarUsuario.usuarioEditar.email}"/>

                    </p:panel> 

                    <p:panel id="setorPanel" styleClass="container_24 clearfix">
                        <h2><a href="#">Setor</a></h2>
                        <br/>
                        <!--                        <p:outputLabel value="Setor : " styleClass="grid_3"/>
                                                <p:inputText styleClass="grid_18" value="{managerCriarUsuario.setor.nome}" readonly="true"/>
                                                <p:commandButton icon="ui-icon-circle-plus" oncomplete="dlg.show();"/>-->
                        <p:outputLabel  for="secInput"
                                        value="Campus:" 
                                        styleClass="grid_3"/>  
                        <div class="grid_8"> 
                            <p:selectOneMenu value="#{managerPesquisarUsuario.secretariaPesquisar}" id="secInput" 
                                             converter="secretariaconverter" >  
                                <f:selectItem  itemValue="" itemLabel=""/>
                                <f:selectItems value="#{managerPesquisarUsuario.todasSecretarias()}" var="p" 
                                               itemLabel="#{p.nome}" itemValue="#{p}"/>  
                                <p:ajax listener="#{managerPesquisarUsuario.todosSetoresSec()}" update=":clienteForm:setInput"/>
                            </p:selectOneMenu> 
                        </div> 
                        <p:outputLabel  for="setInput"
                                        value="Setor : " 
                                        styleClass="grid_3"/> 
                        <div class="grid_8">

                            <p:selectOneMenu value="#{managerPesquisarUsuario.setor}" id="setInput" converter="setorconverter">  
                                <f:selectItem  itemValue="" itemLabel=""/>
                                <f:selectItems value="#{managerPesquisarUsuario.setores}" var="p" itemLabel="#{p.nome}" itemValue="#{p}"/>  
                            </p:selectOneMenu> 
                        </div>
                    </p:panel>
                    <p:panel id="adminPanel" styleClass="container_24 clearfix">
                        <h2><a href="#">Administração</a></h2>
                        <br/> 
<!--                        <p:outputLabel value="Acesso:" styleClass="grid_3"/>-->
                        
                        <p:pickList id="picklistGrupos" style="margin-top: 10px;"
                                    showSourceFilter="true"
                                    showTargetFilter="true" styleClass="grid_12"
                                    value="#{managerPesquisarUsuario.dualGrupo}" var="grupo"
                                    itemLabel="#{grupo.descricao}" converter="grupoconverter" itemValue="#{grupo}">
                            <f:facet name="sourceCaption">Grupo</f:facet>	
                            <f:facet name="targetCaption">Grupo Selecionados</f:facet>
                        </p:pickList>

                    </p:panel>   
                    <br/>
                    <div class="buttonAction">
                        <p:commandButton value="Atualizar" actionListener="#{managerPesquisarUsuario.atualizar()}"
                                         icon="ui-icon-disk" styleClass="ui-priority-primary"
                                         update="@form"  />
                        <p:button value="Cancelar" icon="ui-icon-circle-close"
                                  href="indexusuario.xhtml" />
                    </div>
                </p>
            </h:form>
        </ui:define>
    </ui:composition>
</html>



